void* my_memcpy(void* des, const void* sour, size_t num)
{
	assert(des && sour);
	void* head = des;
	while (num--)
	{
		*(char*)des = *(char*)sour;
		des = (char*)des+1;
		sour = (char*)sour+1;
	}
	return head;
}



void* my_memmove(void* des, void* sour, size_t num)
{
	assert(des && sour);
	const void* head = des;
	//从前往后移动
	if (sour > des)
	{
		while (num--)
		{
			*(char*)des = *(char*)sour;
			des = (char*)des + 1;
			sour = (char*)sour + 1;
		}
	}
	else
	{
		while (num--)
		{
			*((char*)des + num) = *((char*)sour + num);
		}
	}
	return head;
}




int main()
{
	int arr1[] = { 1,2,3,4,5,6,7,8,9 };
	int arr2[20] = {0};
	my_memcpy(arr2, arr1, sizeof(arr1));
	for (int i = 0; i < 9; i++)
	{
		printf("%d ",arr2[i]);
	}

	return 0;
}